﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public static class BinaryExtends
{
    public static Vector3 ReadVector3(this System.IO.BinaryReader reader)
    {
        Vector3 temp;
        temp.x = reader.ReadSingle();
        temp.y = reader.ReadSingle();
        temp.z = reader.ReadSingle();
        return temp;
    }

    public static Quaternion ReadQuaternion(this System.IO.BinaryReader reader)
    {
        Quaternion temp;
        temp.x = reader.ReadSingle();
        temp.y = reader.ReadSingle();
        temp.z = reader.ReadSingle();
        temp.w = reader.ReadSingle();
        return temp;
    }

    public static void WriteVector3(this System.IO.BinaryWriter writer, Vector3 v)
    {
        writer.Write(v.x);
        writer.Write(v.y);
        writer.Write(v.z);
    }

    public static void WriteQuaternion(this System.IO.BinaryWriter writer, Quaternion v)
    {
        writer.Write(v.x);
        writer.Write(v.y);
        writer.Write(v.z);
        writer.Write(v.w);
    }
}
